<template>
  <div class="comprehensiveSetup">
    <div class="title" v-if="false">本月项目建设情况显示设置</div>
    <div class="row" v-if="false">
      <label for="">显示信息：</label>
      <div class="checkbox">
      <el-checkbox-group v-model="checkList">
        <el-checkbox label="1">项目名称</el-checkbox>
        <el-checkbox label="2">项目一级里程碑 </el-checkbox>
        <el-checkbox label="3" >项目二级里程碑</el-checkbox>
      </el-checkbox-group>
      </div>
    </div>
    <div class="title">已完成的项目显示时间设置</div>
    <div class="row">
      <div>
        <el-radio-group v-model="radio">
          <el-radio :label="2">显示一周</el-radio>
          <el-radio :label="3">显示半个月</el-radio>
          <el-radio :label="4">显示一个月</el-radio>
          <el-radio :label="5">显示两个月</el-radio>
          <el-radio :label="6">显示半年</el-radio>
          <el-radio :label="7">显示一年</el-radio>
          <el-radio :label="1">长期显示</el-radio>
          <el-radio :label="0">不显示</el-radio>
        </el-radio-group>
      </div>
    </div>
    <div class="btn" @click="save">保存</div>
    <loading v-if="is_show_loading"></loading>
  </div>
</template>

<script>
  import loading from '@/components/loading'
  export default {
    name: "ComprehensiveSetup",
    data(){
      return{
        is_show_loading:true,
        checkList:['2',],
        radio:3,
      }
    },
    components: {
   loading
    },
    created() {
      this.getProjectInfo();
    },
    methods:{
      //查询项目动态显示设置
      getProjectInfo(){
        let _this=this;
        this.$http.get('user/company/info',{
          params:{
            companyId:this.$store.state.userInfo.companyId
          }
        }).then(res=>{
          if(res.statusCode==200){
            this.radio=res.data.projectCompleteDisplayTime;
            setTimeout(()=> {
              this.is_show_loading=false;
            }, 1000);
          }else {
            _this.$message.error(res.statusMsg);
          }
        })
      },
      //保存
      save(){
        this.$http.post('user/company/update',{
          companyId:this.$store.state.userInfo.companyId,
          projectCompleteDisplayTime:this.radio,
        }).then(res=>{
          if(res.statusCode==200){
            this.$message.success('保存成功');
          }else{
            this.$message.error(res.statusMsg);
          }
        });

      },
    }
  }
</script>

<style scoped type="text/scss" lang="scss">
  .comprehensiveSetup {
    padding: 40px;
    position: relative;
    height: 100%;
    .title {
      padding-bottom: 32px;
      color: #454A55;
      font-size: 16px;
      font-weight: bold;
    }
    .row{
      padding-bottom: 65px;
      label{
        font-size: 16px;
        color: #454A55;
        padding-right: 60px;
      }
      .checkbox{
        display: inline-block;
      }
    }
    .btn{
      background-color: #0755DB;
      border-radius: 6px;
      width: 88px;
      line-height: 32px;
      height: 32px;
      text-align: center;
      font-size: 14px;
      color: #ffffff;
      cursor: pointer;
    }
    .el-radio{
      margin-bottom: 10px;
    }
  }
</style>
